package com.findyou.service.Impl;

import com.findyou.dao.AccountDao;
import com.findyou.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Title: AccountServiceImpl
 * @Author 贾金博
 * @Package com.findyou.service.Impl
 * @Date 2024/12/6 上午9:12
 * @description: 实现类
 */
@Service
public class AccountServiceImpl implements AccountService {

    @Autowired // 默认的是把实现类的 类名 小写 给放到容器里面  这个就是 accountServiceImpl
    private AccountDao accountDao;

    /**
     * 手动的去提交、开启事务
     * @param outUser
     * @param inUser
     * @param money
     */
    @Override
    public void transfer(String outUser, String inUser, Double money) {
        accountDao.out(outUser, money);
        //int x = 1 / 0; // 特意制造一个错误
        accountDao.in(inUser, money);
    }


}
